<?php

/**
 * Nguoi tao: cuongnh
 * Ngay tao: 20/07/2011
 * Y nghia: Lop xu ly chuyen muc
 */
class web_modWebMenu extends Efy_DB_Connection {
	/**
	 * 
	 * Enter description here ...
	 * @param unknown_type $arrParameter
	 */
	public function WebMenuUpdate($arrParameter){		
		$psSql = "Exec Web_MenuUpdate ";
		$psSql .= "'" . $arrParameter['PK_WEB_MENU'] . "'";
		$psSql .= ",'" . $arrParameter['FK_WEB_MENU'] . "'";
		$psSql .= ",'" . $arrParameter['C_NAME'] . "'";
		$psSql .= ",'" . $arrParameter['C_LEVEL'] . "'";
		$psSql .= ",'" . $arrParameter['C_URL'] . "'";
		$psSql .= ",'" . $arrParameter['FK_WEB_ARTICLE'] . "'";			
		$psSql .= ",'" . $arrParameter['C_POSITION'] . "'";
		$psSql .= ",'" . $arrParameter['C_WEB_DISPLAY'] . "'";
		$psSql .= ",'" . $arrParameter['C_WINDOWS_OPEN'] . "'";
		$psSql .= ",'" . $arrParameter['C_ORDER'] . "'";
		$psSql .= ",'" . $arrParameter['C_STATUS'] . "'";
		$psSql .= ",'" . $arrParameter['C_PUBLIC_VIEW'] . "'";
		$psSql .= ",'" . $arrParameter['C_EDIT_ID_LIST'] . "'";
		$psSql .= ",'" . $arrParameter['C_APPROVED_ID_LIST'] . "'";
		$psSql .= ",'" . $arrParameter['C_VIEW_ID_LIST'] . "'";
		$psSql .= ",'" . $arrParameter['C_OWNER_CODE_LIST'] . "'";
		//echo $psSql . '<br>'; exit;
		try {			
			$arrTempResult = $this->adodbExecSqlString($psSql) ; 
			$Result = $arrTempResult['NEW_ID'];
		}catch (Exception $e){
			echo $e->getMessage();
		};
		return $Result;	
	}
	/**
	 * 
	 * Enter description here ...
	 * @param unknown_type $iPosition
	 */
	public function WebMenuGetAll($iPosition,$sOwner,$iLevel, $iStatus){		
		$sql = "Exec Web_MenuGetAll ";
		$sql = $sql . "'" . $iPosition . "'";
		$sql = $sql . ",'" . $sOwner . "'";	
		$sql = $sql . ",'" . $iLevel . "'";		
		$sql = $sql . ",'" . $iStatus . "'";	
		//echo $sql . '<br>'; //exit;
		try{
			$arrResul = $this->adodbQueryDataInNameMode($sql);
		}catch (Exception $e){
			echo $e->getMessage();
		}		
		return $arrResul;
	}
	/**
	 * 
	 */
	public function WebMenuOnHomeGetAll(){		
		$sql = "Exec Web_MenuOnHomeGetAll ";
		//echo $sql . '<br>'; //exit;
		try{
			$arrResul = $this->adodbQueryDataInNameMode($sql);
		}catch (Exception $e){
			echo $e->getMessage();
		}		
		return $arrResul;
	}
	/**
	 * 
	 * Enter description here ...
	 * @param unknown_type $sReceiveDocumentId
	 * @param unknown_type $sUnitId
	 */	
	public function WebMenuGetSingle($sWebMenuId){
		$sql = "Exec Web_MenuGetSingle ";
		$sql .= "'" . $sWebMenuId . "'";
		//echo $sql . '<br>'; //exit;
		try{
			$arrResul = $this->adodbQueryDataInNameMode($sql);
		}catch (Exception $e){
			echo $e->getMessage();
		};		
		return $arrResul;
	}
	/**
	 * 
	 * Enter description here ...
	 * @param unknown_type $sReceiveDocumentIdList
	 * @param unknown_type $iHasDeleteAllPermission
	 */
	public function WebMenuDelete($sMenuIdList){
		$Result = null;			
		$sql = "Exec Web_MenuDelete ";		
		$sql .= "'".$sMenuIdList ."'";	
		//echo $sql . '<br>'; exit;
		try {			
			$arrTempResult = $this->adodbExecSqlString($sql) ; 			
			$Result= $arrTempResult['RET_ERROR'];
		}catch (Exception $e){
			echo $e->getMessage();
		};				
		return $Result;	
	}
	/**
	 * 
	 * Enter description here ...
	 * @param unknown_type $sWebMenuId
	 */
	public function Web_MenuGetOrder($iPosition,$iLevel,$sMenuID){
		$sql = "Exec Web_getOrderbyPosition ";
		$sql .= "'" . $iPosition . "'";
		$sql .= ",'" . $iLevel . "'";
		$sql .= ",'" . $sMenuID . "'";
		//echo $sql . '<br>'; //exit;
		try{
			$arrResul = $this->adodbQueryDataInNameMode($sql);
		}catch (Exception $e){
			echo $e->getMessage();
		};		
		return $arrResul;
	}
	/**
	 * 
	 * Enter description here ...
	 * @param unknown_type $iPosition
	 * @param unknown_type $sOwner
	 * @param unknown_type $iLevel
	 */
	public function WebArticleGetAll($sCreateStaff,$sMenuID,$iStatus,$sFullTextSearch,$iPage,$iNumberRecordPerPage){		
		$sql = "Exec Web_ArticleGetAll ";
		$sql = $sql . "'" . $sCreateStaff . "'";
		$sql = $sql . ",'" . $sMenuID . "'";	
		$sql = $sql . ",'" . $iStatus . "'";		
		$sql = $sql . ",'" . $sFullTextSearch . "'";
		$sql = $sql . ",'" . $iPage . "'";
		$sql = $sql . ",'" . $iNumberRecordPerPage . "'";
		//echo $sql . '<br>'; //exit;
		try{
			$arrResul = $this->adodbQueryDataInNameMode($sql);
		}catch (Exception $e){
			echo $e->getMessage();
		}		
		return $arrResul;
	}
	/**
	 * 
	 * Enter description here ...
	 * @param unknown_type $iPosition
	 * @param unknown_type $sOwner
	 * @param unknown_type $iLevel
	 */
	public function WebArticleByMenuGetAll($sMenuID,$sFullTextSearch,$iPage,$iNumberRecordPerPage,$iNumberRecordPerMenu){		
		$sql = "Exec Web_ArticleViewOnWebGetAll ";
		$sql = $sql . "'" . $sMenuID . "'";			
		$sql = $sql . ",'" . $sFullTextSearch . "'";
		$sql = $sql . ",'" . $iPage . "'";
		$sql = $sql . ",'" . $iNumberRecordPerPage . "'";
		$sql = $sql . ",'" . $iNumberRecordPerMenu . "'";
		//echo $sql . '<br>'; //exit;
		try{
			$arrResul = $this->adodbQueryDataInNameMode($sql);
		}catch (Exception $e){
			echo $e->getMessage();
		}		
		return $arrResul;
	}
	/**
	 * 
	 * Enter description here ...
	 * @param unknown_type $sMenuID
	 * @param unknown_type $sFullTextSearch
	 * @param unknown_type $iPage
	 * @param unknown_type $iNumberRecordPerPage
	 * @param unknown_type $iNumberRecordPerMenu
	 */
	public function WebDocViewOnWebGetAll($sUnitId,$iNumberRecord,$sFullTextSearch,$iCurrentPage, $iNumRowOnPage){		
		$sql = "Exec Web_DocViewOnWebGetAll ";
		$sql = $sql . "'" . $sUnitId . "'";	
		$sql = $sql . ",'" . $iNumberRecord . "'";
                    $sql = $sql . ",'" . $sFullTextSearch . "'";
                    $sql = $sql . ",'" . $iCurrentPage . "'";
                    $sql = $sql . ",'" . $iNumRowOnPage . "'";
		//echo $sql . '<br>'; exit;
		try{
			$arrResul = $this->adodbQueryDataInNameMode($sql);
		}catch (Exception $e){
			echo $e->getMessage();
		}		
		return $arrResul;
	}
	/**
	 * 
	 * Enter description here ...
	 * @param unknown_type $sentID
	 */
	public function docSentGetSingle($sentID){
		$arrResult = null;
		$sql = "Exec Doc_DocSentGetSingle";
		$sql .= "'" . $sentID . "'";
		//echo $sql;
		try{
			$arrResult = $this->adodbQueryDataInNameMode($sql);
		}catch (Exception $e){
			echo $e->getMessage();
		};
		return $arrResult;
	}
	/**
	 * 
	 */
	public function WebArticleBySearchGetAll($sFullTextSearch,$iPage,$iNumberRecordPerPage){		
		$sql = "Exec Web_ArticleSearchGetAll ";	
		$sql = $sql . "'" . $sFullTextSearch . "'";
		$sql = $sql . ",'" . $iPage . "'";
		$sql = $sql . ",'" . $iNumberRecordPerPage . "'";
		//echo $sql . '<br>'; //exit;
		try{
			$arrResul = $this->adodbQueryDataInNameMode($sql);
		}catch (Exception $e){
			echo $e->getMessage();
		}		
		return $arrResul;
	}
	/**
	 * 
	 * Enter description here ...
	 * @param unknown_type $sCreateStaff
	 * @param unknown_type $sMenuID
	 * @param unknown_type $iStatus
	 * @param unknown_type $sFullTextSearch
	 * @param unknown_type $iPage
	 * @param unknown_type $iNumberRecordPerPage
	 */
	public function WebArticleGetSingle($sArticleID){		
		$sql = "Exec Web_ArticleGetSingle ";
		$sql = $sql . "'" . $sArticleID . "'";
		//echo $sql . '<br>'; //exit;
		try{
			$arrResul = $this->adodbQueryDataInNameMode($sql);
		}catch (Exception $e){
			echo $e->getMessage();
		}		
		return $arrResul;
	}
	/**
	 * 
	 * Kiem tra quyen tin bai
	 * @param unknown_type $sArticleIdList
	 */
	public function WebArticlePermissionCheck($sStaffId,$sPermission,$iHaveArticle){	
		$sql = "Exec Web_ArticlePermissionCheck ";		
		$sql .= "'".$sStaffId ."'";	
		$sql .= ",'".$sPermission ."'";	
		$sql .= ",'".$iHaveArticle ."'";	
		//echo $sql . '<br>'; //exit;
		try{
			$arrResul = $this->adodbQueryDataInNameMode($sql);
		}catch (Exception $e){
			echo $e->getMessage();
		}		
		return $arrResul;
	}
	/**
	 * 
	 * Enter description here ...
	 * @param unknown_type $iPosition
	 * @param unknown_type $sOwner
	 * @param unknown_type $iLevel
	 */
	public function WebHomeInfoGetAll($sMenuIdList,$iCountInMenu){		
		$sql = "Exec Web_HomeInfoGetAll ";
		$sql = $sql . "'" . $sMenuIdList . "'";	
		$sql = $sql . ",'" . $iCountInMenu . "'";				
		//echo $sql . '<br>'; //exit;
		try{
			$arrResul = $this->adodbQueryDataInNameMode($sql);
		}catch (Exception $e){
			echo $e->getMessage();
		}		
		return $arrResul;
	}
	/**
	 * Enter description here...
	 *
	 * @param unknown_type $sMenuIdList
	 * @param unknown_type $iCountInMenu
	 * @return unknown
	 */
	public function WebHightlightGetAll(){		
		$sql = "Exec Web_HightlightGetAll ";		
		//echo $sql . '<br>'; //exit;
		try{
			$arrResul = $this->adodbQueryDataInNameMode($sql);
		}catch (Exception $e){
			echo $e->getMessage();
		}		
		return $arrResul;
	}
	/**
	 * 
	 */
	public function Schedule_StaffGetSingle($staff_id,$wekk,$year){
		$sql = "Exec Schedule_StaffGetSingle ";
		$sql = $sql . "'" . $staff_id . "'";
		$sql = $sql . ",'" . $wekk . "'";
		$sql = $sql . ",'" . $year . "'";		
		//echo '<br>'.$sql . '<br>'; //exit;
		try{
			$arrResul = $this->adodbQueryDataInNameMode($sql);
		}catch (Exception $e){
			echo $e->getMessage();
		}			
		return $arrResul;
	}
	public function ScheduleUnitGetToday($iWeek,$iYear,$sDay,$iStaus,$Owenercode){		
		$sql = "Exec Schedule_UnitGetToday ";
		$sql .= "'" . $iWeek . "'";
		$sql .= ",'" . $iYear . "'";
		$sql .= ",'" . $sDay . "'";
		$sql .= ",'" . $iStaus . "'";
		$sql .= ",'" . $Owenercode . "'";
		//echo $sql . '<br>'; //exit;
		try{
			$arrResul = $this->adodbQueryDataInNameMode($sql);
		}catch (Exception $e){
			echo $e->getMessage();
		}		
		return $arrResul;
	}
	/**
	 * 
	 */
	public function TaskWorkNotyGetAll($staff_id,$sStaffRole,$sUnitID,$sUnitType){		
		$sql = "Exec Task_WorkNotyGetAll ";
		$sql .= "'" . $staff_id . "'";
		$sql .= ",'" . $sStaffRole . "'";
		$sql .= ",'" . $sUnitID . "'";
		$sql .= ",'" . $sUnitType . "'";
		//echo $sql . '<br>'; //exit;
		try{
			$arrResul = $this->adodbQueryDataInNameMode($sql);
		}catch (Exception $e){
			echo $e->getMessage();
		}		
		return $arrResul;
	}
	/** Nguoi tao: NGHIAT
	* Ngay tao: 05/08/2010
	* Y nghia: Lay ra danh sach nhac viec
	*/
	public function docReminderGetAll($iUserId,$iDepartmentId,$iOwnerId,$sPermissionList,$sGroupUserList,$iPosition){
		$sql = "Doc_DocReminderGetAll ";
		$sql = $sql . " '" . $iUserId . "'";
		$sql = $sql . ",'" . $iDepartmentId . "'";		
		$sql = $sql . ",'" . $iOwnerId . "'";	
		$sql = $sql . ",'" . $sPermissionList . "'";	
		$sql = $sql . ",'" . $sGroupUserList . "'";
		$sql = $sql . ",'" . $iPosition . "'";	
		//echo  "<br>". $sql . "<br>"; 
		//exit;
		try{
			$arrReminder = $this->adodbQueryDataInNameMode($sql);
		}catch (Exception $e){
			echo $e->getMessage();
		}
		return $arrReminder;		
	}
	/**
	 * Idea : Lay thong tin danh muc 
	 *
		* @param  	@code					Varchar(50)			-- Ma loai danh muc
	 * 						
	 * @return Mang chua danh sach doi tuong loai danh muc
	 */
	public function getPropertiesDocumentByOwner($code,$ower_id){
		$sql = "EfyLib_ListGetAllbyCode ";
		$sql = $sql . "'" . $code . "'";
		$sql = $sql . ",''";
		$sql = $sql . ",''";
		$sql = $sql . ",'1'";
		$sql = $sql . ",'" . $ower_id . "'";
		//echo '$sql'.$sql;
		try {
			$arrSel = $this->adodbQueryDataInNameMode($sql);
		}catch (Exception $e){
			echo $e->getMessage();
		}
		return $arrSel;
	}
	/**
	 * 						
	 * @return Mang chua danh sach doi tuong loai danh muc video
	 */
	public function getListMediaByOwner($code,$sFullTextSearch, $iPage, $iNumberRecordPerPage,$ower_id){
		$sql = "Web_MediaGetAllbyListCode ";
		$sql = $sql . "'" . $code . "'";
		$sql = $sql . ",'" . $sFullTextSearch . "'";
		$sql = $sql . ",'" . $iPage . "'";
		$sql = $sql . ",'" . $iNumberRecordPerPage . "'";
		$sql = $sql . ",'" . $ower_id . "'";
		//echo '$sql'.$sql;
		try {
			$arrSel = $this->adodbQueryDataInNameMode($sql);
		}catch (Exception $e){
			echo $e->getMessage();
		}
		return $arrSel;
	}
	/**
	 * 
	 * Enter description here ...
	 * @param unknown_type $iFkUnit
	 * @param unknown_type $sFromDate
	 * @param unknown_type $sToDate
	 * @param unknown_type $sFullTextSearch
	 * @param unknown_type $iPage
	 * @param unknown_type $iNumberRecordPerPage
	 */
	public function TrafficViolationsGetAll($sOwnerCode,$sFromDate,$sToDate,$sFullTextSearch, $iPage, $iNumberRecordPerPage){		
		$sql = "Exec Web_TrafficViolationsGetAll ";
		$sql = $sql . "'" . $sOwnerCode . "'";
		$sql = $sql . ",'" . $sFromDate . "'";
		$sql = $sql . ",'" . $sToDate . "'";
		$sql = $sql . ",'" . $sFullTextSearch . "'";
		$sql = $sql . ",'" . $iPage . "'";
		$sql = $sql . ",'" . $iNumberRecordPerPage . "'";	
		//echo $sql . '<br>'; //exit;
		try{
			$arrResul = $this->adodbQueryDataInNameMode($sql);
		}catch (Exception $e){
			echo $e->getMessage();
		}		
		return $arrResul;
	}
	/**
	 * Enter description here...
	 *
	 * @param unknown_type $sOwnerCode
	 * @param unknown_type $sFromDate
	 * @param unknown_type $sToDate
	 * @param unknown_type $sFullTextSearch
	 * @return unknown
	 */
	public function TrafficViolationsPrintGetAll($sOwnerCode,$sFromDate,$sToDate,$sFullTextSearch){		
		$sql = "Exec Web_TrafficViolationsPrintGetAll ";
		$sql = $sql . "'" . $sOwnerCode . "'";
		$sql = $sql . ",'" . $sFromDate . "'";
		$sql = $sql . ",'" . $sToDate . "'";
		$sql = $sql . ",'" . $sFullTextSearch . "'";
		//echo $sql . '<br>'; //exit;
		try{
			$arrResul = $this->adodbQueryDataInNameMode($sql);
		}catch (Exception $e){
			echo $e->getMessage();
		}		
		return $arrResul;
	}
	/**
	 * 
	 * Enter description here ...
	 * @param unknown_type $arrParameter
	 */
	public function TrafficViolationsUpdate($arrParameter){
		$psSql = "Exec Web_TrafficViolationsUpdate ";	
		$psSql .= "'" . $arrParameter['PK_TRAFFIC_VIOLATIONS'] . "'";		
		$psSql .= ",'" . $arrParameter['FK_CREATE_STAFF_ID'] . "'";
		$psSql .= ",'" . $arrParameter['C_VIOLATIONS_DATE'] . "'";
		$psSql .= ",'" . $arrParameter['C_OBJECT_NAME'] . "'";
		$psSql .= ",'" . $arrParameter['C_ADDRESS'] . "'";
		$psSql .= ",'" . $arrParameter['C_CONTENT'] . "'";
		$psSql .= ",'" . $arrParameter['C_NUMBER_DECISION'] . "'";
		$psSql .= ",'" . $arrParameter['C_UNIT_PROCESS'] . "'";
		$psSql .= ",'" . $arrParameter['C_UNIT_PROCESS_NAME'] . "'";
		$psSql .= ",'" . $arrParameter['C_FINES'] . "'";		
		$psSql .= ",'" . $arrParameter['ATTACH_FILE_NAME_LIST'] . "'";
		$psSql .= ",'" . $arrParameter['C_OWNER_CODE'] . "'";
		//Thuc thi lenh SQL	
		//echo htmlspecialchars($psSql); exit;
		try {			
			$arrTempResult = $this->adodbExecSqlString($psSql) ; 
			$Result = $arrTempResult['NEW_ID'];
		}catch (Exception $e){
			echo $e->getMessage();
		};
		//Return result
		return $Result;		
	}
	/**
	 * 
	 * Enter description here ...
	 * @param unknown_type $sTaskWorkId
	 */
	public function TrafficViolationsGetSingle($sTrafficViolationsId){
		$sql = "Exec Web_TrafficViolationsGetSingle ";
		$sql .= "'" . $sTrafficViolationsId . "'";
		//echo $sql . '<br>'; //exit;
		try{
			$arrReceived = $this->adodbQueryDataInNameMode($sql);
		}catch (Exception $e){
			echo $e->getMessage();
		};		
		return $arrReceived;
	}
	/**
	 * 
	 * Enter description here ...
	 * @param unknown_type $sTaskWorkIdList
	 */
	public function TrafficViolationsDelete($sTrafficViolationsIdList){
		$Result = null;			
		$sql = "Exec Web_TrafficViolationsDelete ";		
		$sql .= "'".$sTrafficViolationsIdList ."'";	
		//echo $sql . '<br>'; exit;
		try {			
			$arrTempResult = $this->adodbExecSqlString($sql) ; 			
			$Result= $arrTempResult['RET_ERROR'];
		}catch (Exception $e){
			echo $e->getMessage();
		};				
		return $Result;	
	}
	/**
	 * 
	 * Enter description here ...
	 * @param unknown_type $pReceiveDocumentId
	 * @param unknown_type $pFileTyle
	 * @param unknown_type $pTableObject
	 */
	public function DOC_GetAllDocumentFileAttach($pReceiveDocumentId, $pFileTyle, $pTableObject){
		$sql = "Exec Doc_GetAllDocumentFileAttach '" . $pReceiveDocumentId . "'";
		$sql .= ",'".$pFileTyle ."'";		
		$sql .= ",'".$pTableObject ."'"; 
		//echo $sql . '<br>';
		try {						
			$arrResult = $this->adodbQueryDataInNameMode($sql);					
		}catch (Exception $e){
			echo $e->getMessage();
		};				
		return $arrResult;			
	}
}	
?>